package com.scenery;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;

import com.scenery.vo.Scenery;
/****
 * 
 * 景点详细信息
 * **/
public class SceneryInfoActivity extends Activity {
	/**
	 * @see android.app.Activity#onCreate(Bundle)
	 */
	String tag=SceneryActivity.class.getName();
	TextView name,grade,address;
	WebView intro,buyNotice;
	Button dpBtn;
	Scenery bean;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// TODO Put your code here
		Log.d(tag, "onCreate");
		setContentView(R.layout.scenery_info);
		name=(TextView) findViewById(R.id.name);
		grade=(TextView) findViewById(R.id.grade);
		address=(TextView) findViewById(R.id.address);
		intro=(WebView) findViewById(R.id.intro);
		buyNotice=(WebView) findViewById(R.id.buyNotice);
		dpBtn=(Button)findViewById(R.id.dpBtn);
		dpBtn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent it=new Intent();
				Bundle bundle = new Bundle();
				bundle.putParcelable("bean", bean);
				it.putExtras(bundle);
				it.setClass(SceneryInfoActivity.this, DianPingActivity.class);
				startActivity(it);
			}
		});
		Bundle bundle = this.getIntent().getExtras();
		 bean=	bundle.getParcelable("bean");
		name.setText(bean.getSceneryName());
		grade.setText(bean.getGrade());
		address.setText(bean.getAddress());
		
		intro.loadDataWithBaseURL("about:blank", bean.getIntro(), "text/html", "utf-8", null);
		
		buyNotice.loadDataWithBaseURL("about:blank", bean.getBuyNotice(), "text/html", "utf-8", null);
	}
	
    private String fmtString(String str){  
        String notice = "";  
        try{  
            notice = URLEncoder.encode(str, "utf-8");  
        }catch(UnsupportedEncodingException ex){  
              
        }  
        return notice;  
    }  
}
